import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { EventEmitterModule } from '@nestjs/event-emitter';
import { CommonConfigRegister } from './modules/config/registers/common.register';
import { MqttConfigRegister } from './modules/config/registers/mqtt.register';
import { ConfigValidation } from './modules/config/validations/config.validation';
import { MqttModule } from './modules/mqtt/mqtt.module';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      validationSchema: ConfigValidation,
      validationOptions: {
        allowUnknown: true,
        abortEarly: true
      },
      load: [CommonConfigRegister, MqttConfigRegister]
    }),
    EventEmitterModule.forRoot({
      wildcard: false,
      delimiter: '.',
      newListener: false,
      removeListener: false,
      maxListeners: 10,
      verboseMemoryLeak: false,
      ignoreErrors: false
    }),
    MqttModule
  ],
  controllers: [],
  providers: []
})
export class AppModule {}
